import io.netty.channel.ChannelHandlerContext;

public class PingMessageResolver extends Resolver {
    @Override
    boolean support(IMessage iMessage) {
        return MessageTypeEnum.PING.equals(iMessage.getType());
    }

    @Override
    IMessage resolver(IMessage iMessage, ChannelHandlerContext ctx) {
        // 接收到ping消息后，返回一个pong消息返回
        System.out.println("receive ping message: " + System.currentTimeMillis());
        IMessage pong = new IMessage();
        pong.setType(MessageTypeEnum.PONG);
        return pong;
    }
}
